package com.gq.tab.scr;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.gq.dungsihesman.R;
import com.rtst.widget.actionbar.ISearchInterface;
import com.rtst.widget.tab.TabFragment;

public class CategoryScr extends TabFragment implements ISearchInterface {
	private static final String TAG = "CategoryScr";
	ViewGroup mLayout;
	String[] items = {"Tin tức", "Bóng đá", "Đọc truyện", "Xem ảnh", "Xổ số", "Chiêm tinh", "Địa điểm", "Nhạc chuông", "Tuyển sinh"};
	
	private int mType = TYPE_HOME;
	public static final int TYPE_HOME = 0x0;
	
	public CategoryScr() {
		mType = TYPE_HOME;
	}
	
	public CategoryScr(int type) {
		mType = type;
	}
	
	public CategoryScr(String previousScrTag, int type) {
		super(previousScrTag);
		mType = type;
	}
	
	public CategoryScr(int type, String gd) {
		mType = type;
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		if(mLayout == null) {
			mLayout = (ViewGroup) inflater.inflate(R.layout.category_scr_layout, container, false);
			Log.i(TAG, getPreviousScrTag() + getTag() + mType);
		} else {
			((ViewGroup) mLayout.getParent()).removeView(mLayout);
		}
		return mLayout;
	}
	
	private void setUpForTypeHome() {
		ListView listview = (ListView) mLayout.findViewById(android.R.id.list);
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), R.layout.item_list, items);
		listview.setAdapter(adapter);
		listview.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			}
		});
	}
	

	@Override
	public void onSearchComplete(final CharSequence in) {
	}
}
